<?php
/**
 * focuscontroller.php
 * 
 * Create on 2015-04-01 17:18:43
 * Create by yuebin
 */
namespace haibao\cms\business\control\pc\index;
use \haibao\cms\business\control\PublishController;

class FocusController extends \haibao\cms\business\control\pc\channel\ChannelController{
	
	public function __construct($updateTime = null,$controlId,$isPublish){
	    $this->savaLog();
		parent::__construct($updateTime,$controlId,$isPublish);
	}
	
	/**
	 * 显示模版内容（模版动态数据的绑定和模版输出）
	 * @param : String $content
	 * @param : Array $controlData;
	 */
	public function displayTemplateHtml(){
		$controlData = $this->getParameter(self::$CONTROL_DATA);
		$content = $this->getParameter(self::$CONTROL_CONTENT);
		$path = $this->generateHtmlPath(__CLASS__);
		$parameters = $this->getControlParameters($controlData);
		$isNew = 0;
		if($controlData['manual'] && isset($controlData['manual']['isNew'])){
		    $isNew = $controlData['manual']['isNew'];
		}
		//品牌库首页幻灯片 同步品牌首页
		if($controlData['manual'] && $controlData['manual']['id'] == 270){
		    $controlData = PublishController::getPageControlDataByControlId(54);
		    if($controlData){
		        $parameters = array();
		        foreach($controlData as $key=>$data){
		            array_push($parameters,json_decode($data->ParameterValue));
		        }
		    }
		}

		$this->assign('isNew', $isNew);
		$this->assign('parameters', $parameters);
		$this->assign('userHostColler', \haibao\classlibrary\cms\Config::getConfig(\haibao\classlibrary\cms\Config::CLASSLIBRARY_CONFIG_HOST_USER));
		$this->generateHtml($path, $content);
		return $this->getHtml($path);
	}
	
}